import {I18Parse,CommonLang} from '@lowcode/jpaas-common-lib';
import systemApiLang from '../../../locales/lang/impl/sysMgr/systemApiLang';
let lang = systemApiLang.systemApi;
let comLang= CommonLang;
let i18n=function (langKey,text) {
    return I18Parse.getI18Val(lang,langKey, text);
}

var authSettings = {
  //流程分类相关权限
  "BPM":[{id:'1',type:'task',typeName:i18n('taskAuth','待办任务权限'),children:[
      {id:'5',parentId:'1',type:'read',typeName:i18n('readAuth','阅读权限'),setting:'everyone',settingName:i18n('everyone','所有人')}
    ]},
    {id:'2',type:'def',typeName:i18n('defAuth','流程定义权限'),children:[
        {id:'6',parentId:'2',type:'read',typeName:i18n('readAuth','阅读权限'),setting:'everyone',settingName:i18n('everyone','所有人')},
        {id:'7',parentId:'2',type:'start',typeName:i18n('start','启动'),setting:'everyone',settingName:i18n('everyone','所有人')},
        {id:'8',parentId:'2',type:'add',typeName:I18Parse.getI18Val(comLang,'rxList.newBtn', '添加'),setting:'everyone',settingName:i18n('everyone','所有人')},
        {id:'9',parentId:'2',type:'design',typeName:i18n('devise','设计'),setting:'everyone',settingName:i18n('everyone','所有人')},
        {id:'10',parentId:'2',type:'delete',typeName:I18Parse.getI18Val(comLang,'rxList.delBtn', '删除'),setting:'everyone',settingName:i18n('everyone','所有人')},
    ]},
    {id:'3',type:'inst',typeName:i18n('instAuth','流程实例权限'),children:[
        {id:'11',parentId:'3',type:'read',typeName:i18n('readAuth','阅读权限'),setting:'everyone',settingName:i18n('everyone','所有人')},
        {id:'12',parentId:'3',type:'intervene',typeName:i18n('intervention','干预'),setting:'everyone',settingName:i18n('everyone','所有人')},
        {id:'13',parentId:'3',type:'delete',typeName:I18Parse.getI18Val(comLang,'rxList.delBtn', '删除'),setting:'everyone',settingName:i18n('everyone','所有人')}
    ]},
    {id:'4',type:'start',typeName:i18n('startAuth','流程发起权限'),children:[
        {id:'14',parentId:'4',type:'read',typeName:i18n('readAuth','阅读权限'),setting:'everyone',settingName:i18n('everyone','所有人')},
        {id:'15',parentId:'4',type:'mobileRead',typeName:i18n('mobileReadAuth','手机阅读权限'),setting:'everyone',settingName:i18n('everyone','所有人')},
    ]}]
}
authSettings.getByType=function(type){
  var ary=authSettings[type];
  if(!ary){
    //默认权限
    ary=[{id:'1',type:'read',typeName:i18n('readAuth','阅读权限'),setting:'everyone',settingName:i18n('everyone','所有人')},
      {id:'2',type:'add',typeName:i18n('addAuth','添加权限'),setting:'everyone',settingName:i18n('everyone','所有人')},
      {id:'3',type:'edit',typeName:i18n('editAuth','编辑权限'),setting:'everyone',settingName:i18n('everyone','所有人')},
      {id:'4',type:'delete',typeName:i18n('delAuth','删除权限'),setting:'everyone',settingName:i18n('everyone','所有人')}];
  }
  return ary;
}


export default authSettings;